<?php

/**
 * TravelMileage form base class.
 *
 * @package    form
 * @subpackage travel_mileage
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseTravelMileageForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'id_number'    => new sfWidgetFormInput(),
      'airline_id'   => new sfWidgetFormDoctrineChoice(array('model' => 'Airline', 'add_empty' => false)),
      'date_issued'  => new sfWidgetFormDate(),
      'date_valid'   => new sfWidgetFormDate(),
      'passenger_id' => new sfWidgetFormDoctrineChoice(array('model' => 'Passenger', 'add_empty' => false)),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorDoctrineChoice(array('model' => 'TravelMileage', 'column' => 'id', 'required' => false)),
      'id_number'    => new sfValidatorString(array('max_length' => 255)),
      'airline_id'   => new sfValidatorDoctrineChoice(array('model' => 'Airline')),
      'date_issued'  => new sfValidatorDate(),
      'date_valid'   => new sfValidatorDate(),
      'passenger_id' => new sfValidatorDoctrineChoice(array('model' => 'Passenger')),
      'created_at'   => new sfValidatorDateTime(array('required' => false)),
      'updated_at'   => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('travel_mileage[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'TravelMileage';
  }

}
